In [1]:
from IPython.display import HTML, display, Markdown

from bokeh.layouts import column, row
from bokeh.models import LinearAxis, Range1d, NumeralTickFormatter,DatetimeTickFormatter, HoverTool
from bokeh.plotting import figure, output_notebook, show
from bokeh.resources import INLINE

import datetime
import dateutil
import glob
import h5py
import numpy as np
import pandas as pd
import pytz
import sys

from plotting import (plot_candlestick_singleday, 
                      plot_trades_singleday, 
                      plot_volume_singleday,
                      pnl_multilineplot_bokeh, 
                      pnl_bar_win_lose_rect, 
                      pnl_bar_long_short_rect,
                      durationplot)

output_notebook()
Loading BokehJS ...
In [2]:
eastern_tz = pytz.timezone('US/Eastern')
local_tz = dateutil.tz.tzlocal()

def dt_from_muts(ts):
    """
    Convert an integer number of microseconds since the epoch into a datetime object
    (implicitly in Eastern time, but no timezone set)
    """
    dt = datetime.datetime.fromtimestamp(int(ts // 1000000)).replace(microsecond=int(ts % 1000000),
                                                                     tzinfo=local_tz).astimezone(eastern_tz).replace(
        tzinfo=None)
    return dt

def top_bottom_minbar(odr, annotate=False, resample_freq='15min' ,top_bot='all', num_charts=10  ):
    """
    generates minute bar plots for  Top/Bottom 10 orders a user made 
    """
    j = []
    # Create GroupBys of Top 10/ Bottom 10 Trades in Strategy / Export date+symbol to list
    odr_p = odr[odr.entry_pl>0]
    odr_n = odr[odr.entry_pl<0]
    if odr_p.shape[0] == 0 and top_bot=='top':
        print 'No profitable trades in strategy'
        return
    if odr_n.shape[0] == 0 and top_bot=='bot':
        print 'No losing trades in strategy'
        return
    if top_bot == 'top' and odr_p.shape[0] > 0: 
        j.extend(pd.DataFrame(odr_p.entry_pl.groupby([odr_p.index.date.astype(str),odr_p.symbol]).sum()).sort_values('entry_pl',ascending=False).iloc[:num_charts].index)
    elif top_bot == 'bot'and odr_n.shape[0] > 0:
        j.extend(pd.DataFrame(odr_n.entry_pl.groupby([odr_n.index.date.astype(str),odr_n.symbol]).sum()).sort_values('entry_pl',ascending=True).iloc[:num_charts].index)

    MIN_BAR_DIR = '/mnt/gv0/mktdb5/bar/time/60/'
    CQ_MIN_BAR_DIR = "/srv/mktdb5/bar/time/60/"
    
    plt_list = []
    for i in j:
        h5 = CQ_MIN_BAR_DIR+i[0]+'.hdf5'  ## will need to replace with wes's MB read
        sym = i[1]
        dataset = 'groups/bar/'+sym
        f = h5py.File(h5, 'r')
        df = pd.DataFrame(f[dataset][:])
        
        if resample_freq == '1min' :
            bar_width = 50000
        else:
            bar_width = max(500000, 25000000/(df.shape[0]*1.25))
        df.index = df.timestamp.apply(lambda x: dt_from_muts(x))
        candle_plot = plot_candlestick_singleday(df,
                                                 symbol=sym,
                                                 resample_freq=resample_freq,
                                         annotate=annotate,
                                        bar_width=bar_width)
        trd = odr[(odr.symbol == sym) & (odr.index.date.astype(str)== i[0])]  # filter trade data to this specific trade
        candle_plot = plot_trades_singleday(trd, figure=candle_plot)  # add trades to candlestick plot
        vol_plot = plot_volume_singleday(df, symbol=sym, annotate=annotate)
        plt_list.append(column(candle_plot,vol_plot))

    return plt_list

def summaryWinLoseDate(df):
    """
    returns aggregation of trade data winners/ losers and total by date for multiple statistics
    """
    grouper=df[['entry_pl','entry_shares','entry_time','Win']].groupby([df.index.date,df.Win])
    jg=grouper.aggregate({'entry_pl':'sum','Win':'count','entry_shares':'sum'}).unstack()
    jg=jg.swaplevel(0,1,axis=1).sort_index(axis=1)
    tp=pd.DataFrame()
    tl=pd.DataFrame()
    if 'Win' in jg.columns:
        tp=jg['Win'].copy()
        tp['AvgPNL']=tp.entry_pl/tp.Win
    if 'Loss' in jg.columns:
        tl=jg['Loss'].copy()
        tl['AvgPNL']=tl.entry_pl/tl.Win
    grouper=df[['entry_pl','entry_shares','entry_time','Win']].groupby([df.index.date])
    pb=pd.DataFrame(grouper.aggregate({'entry_pl':'sum','Win':'count','entry_shares':'sum'}))
    pb['AvgPNL']=pb.entry_pl/pb.Win  
    if tp.shape[0] and tl.shape[0] > 0:
        summ=pd.concat({'Total':pb,'Winners':tp,'Losers':tl},axis=1)
        summ=summ.applymap(lambda x: round(x,2))
        summ=summ[['Total','Winners','Losers']]
    elif tp.shape[0] >0 :
        summ=pd.concat({'Total':pb,'Winners':tp},axis=1)
        summ=summ.applymap(lambda x: round(x,2))
        summ=summ[['Total','Winners']]
    else:
        summ=pd.concat({'Total':pb,'Losers':tl},axis=1)
        summ=summ.applymap(lambda x: round(x,2))
        summ=summ[['Total','Losers']]
    summ.fillna(0,inplace=True)
    return summ
In [3]:
# Read and prepare order trades data
non_null_columns = ['entry_pl', 'entry_price', 'entry_shares', 'entry_side', 'entry_time', 'exit_price',
                   'exit_shares', 'exit_time', 'exit_side']
odr = pd.read_csv('trades.csv')
odr.index = pd.to_datetime(odr.entry_time)
odr.sort_index(inplace=True)
odr.entry_time = pd.to_datetime(odr.entry_time)
odr.exit_time = pd.to_datetime(odr.exit_time)    
odr['returns'] = odr.entry_pl / (odr.entry_price*odr.entry_shares)
odr['duration'] = (odr.exit_time-odr.entry_time).astype('timedelta64[m]')
odr['Win'] = (odr.entry_pl> 0).map({True:'Win', False: 'Loss' })
odr['entry_pl_share'] = odr.entry_pl/odr.entry_shares.abs()
odr['Efficiency'] = odr.entry_pl/odr.entry_shares.abs()
no_null = (~odr[non_null_columns].isnull().any(axis=1))
odr = odr.loc[no_null]
In [4]:
display(Markdown('# Strategy Summary Notebook \n \
This is the summary report of your cloudquant strategy, in it you will find high level statistics and visualizations of strategy performance and trade analysis.\
'))
# generate formated strings for table output
entry_date = str(odr.index.date.min())
exit_date = str(odr.index.date.max())
tpnl = format(odr.entry_pl.sum(), '.2f')
avef = format(odr.Efficiency.mean(), '.2f')
winp = format(100* float(odr[odr.entry_pl>0].entry_pl.count())/ odr.entry_pl.count(), '.2f')
tloss = format(odr[odr.Win=='Loss'].entry_pl.sum(), '.2f')
lossp = format(100* abs(odr[odr.Win=='Loss'].entry_pl.sum()) / (odr.entry_pl.sum()), '.2f')

# Html formated summary notes
HTML('<b>Entry Date :</b>&emsp; '+entry_date+'<br>\
      <b>Exit Date &nbsp;&nbsp;:</b> &emsp;'+exit_date+'<br>\
     <table style="width:35%">\
<tr><td style="background-color:#3090C7;"><b>Total PNL</b></td><td>'+tpnl+'</td></tr>\
<tr><td style="background-color:#3090C7;"><b>Avg Efficiency</b></td><td>'+avef+'</td></tr>\
<tr><td style="background-color:#3090C7;"><b>Win Percent</b></td><td>'+winp+'%'+'</td></tr>\
<tr><td style="background-color:#3090C7;"><b>Total Losses</b></td><td>'+tloss+'</td></tr>\
<tr><td style="background-color:#3090C7;"><b>Loss/PNL</b></td><td>'+lossp+'%'+'</td></tr>\
</table>')

Strategy Summary Notebook

This is the summary report of your cloudquant strategy, in it you will find high level statistics and visualizations of strategy performance and trade analysis.

Out[4]:
Entry Date :  2023-02-01
Exit Date   :  2023-05-04
Total PNL263245.34
Avg Efficiency0.01
Win Percent53.66%
Total Losses-1036416.91
Loss/PNL393.71%
In [5]:
show(pnl_multilineplot_bokeh(odr))
BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
In [6]:
from plotting import pnl_bar_long_short_rect
pb = pd.DataFrame(odr.entry_pl.groupby([odr.index.year,odr.index.month,odr.Win]).sum()).reset_index(level=2)
pb.index = pb.index.map(lambda x: pd.to_datetime('{}/{}'.format(str(x[0]),str(x[1]))))
ymin,ymax = min(pb['entry_pl']), max(pb['entry_pl'])

tot=pd.DataFrame(pb.entry_pl.groupby(pb.index).sum())
tot['Win']='Total'
pb=pb.append(tot)

pg = pd.DataFrame(odr.entry_pl.groupby([odr.index.year,odr.index.month,odr.entry_side]).sum()).reset_index(level=2)
pg.index = pg.index.map(lambda x: pd.to_datetime('{}/{}'.format(str(x[0]),str(x[1]))))
pg.entry_side=pg.entry_side.map({-1:'Short',1:'Long'})

if ~pb.empty:
    p = pnl_bar_win_lose_rect(pb, ymin,ymax)
if ~pg.empty:
    p1 = pnl_bar_long_short_rect(pg, ymin, ymax)
if p and p1:    
    show(row(p,p1))
/opt/anaconda/lib/python2.7/site-packages/pandas/core/frame.py:6692: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.

To accept the future behavior, pass 'sort=False'.

To retain the current behavior and silence the warning, pass 'sort=True'.

  sort=sort)
BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
In [7]:
BS= (odr.entry_side==1) & (odr.duration<=1440) & np.isfinite(odr.returns)
SS= (odr.entry_side==0) & (odr.duration<=1440) & np.isfinite(odr.returns)

if odr[BS].shape[0]>0:
    show(durationplot(odr[BS], title='Long Position Returns by Duration in Minutes'))
if odr[SS].shape[0]>0:
    show(durationplot(odr[SS], title='Short Position Returns by Duration in Minutes'))

Top 10 Trades

In [8]:
odr.sort_values(by='entry_pl',ascending=False)[['entry_pl','symbol','entry_shares','entry_price','exit_price','Efficiency']].iloc[:10]
Out[8]:
entry_pl symbol entry_shares entry_price exit_price Efficiency
entry_time
2023-04-11 15:36:20.006 1311.72 SPY -1286 410.83 409.81 1.020000
2023-02-22 14:00:20.006 1128.00 SPY -1977 400.52 399.56 0.570561
2023-02-24 15:28:50.006 961.62 SPY -753 396.79 395.38 1.277052
2023-02-24 15:29:40.006 959.79 SPY -897 396.45 395.38 1.070000
2023-02-14 10:31:30.006 911.40 SPY -552 413.18 411.32 1.651087
2023-02-14 10:32:10.006 824.25 SPY -652 412.89 411.32 1.264187
2023-02-01 14:30:40.006 824.00 SPY -1382 404.39 403.36 0.596237
2023-03-10 15:33:30.006 785.00 SPY -500 386.33 384.76 1.570000
2023-03-14 13:10:10.006 777.89 SPY -1487 390.36 389.29 0.523127
2023-03-09 15:15:50.006 775.71 SPY -511 392.36 390.83 1.518023
In [9]:
top_10=top_bottom_minbar(odr,
                         annotate=True, 
                         resample_freq='1min',
                         top_bot='top',
                        num_charts=10)
if top_10:
    show ( column (*top_10))

Bottom 10 Trades

In [10]:
odr.sort_values(by='entry_pl',ascending=True)[['entry_pl','symbol','entry_shares','entry_price','exit_price','Efficiency']].iloc[:10]
Out[10]:
entry_pl symbol entry_shares entry_price exit_price Efficiency
entry_time
2023-05-03 13:59:10.006 -1301.34 SPY -1126 412.04 413.27 -1.155719
2023-05-03 14:35:30.006 -1116.70 SPY -2715 410.90 411.55 -0.411308
2023-02-01 14:00:10.006 -1096.32 SPY -5241 403.91 404.55 -0.209181
2023-02-01 14:00:10.006 -1078.24 SPY -5241 403.91 404.83 -0.205732
2023-02-01 14:00:20.006 -1067.77 SPY -982 403.70 405.57 -1.087342
2023-05-03 14:00:10.006 -939.76 SPY -3675 411.79 413.15 -0.255717
2023-05-03 14:44:20.006 -773.90 SPY -1247 411.64 412.73 -0.620609
2023-03-21 15:34:50.006 -687.96 SPY -637 398.06 399.14 -1.080000
2023-03-15 10:50:40.006 -626.04 SPY -693 384.42 385.53 -0.903377
2023-02-14 12:53:40.006 -591.85 SPY -677 410.35 411.24 -0.874225
In [11]:
bot_10=top_bottom_minbar(odr,
                         annotate=True, 
                         resample_freq='1min',
                         top_bot='bot',
                        num_charts=10)
if bot_10:
    show ( column (*bot_10))

Top Efficient Trades

In [12]:
odr.sort_values(by='Efficiency',ascending=False)[['entry_pl','symbol','entry_shares','entry_price','exit_price','Efficiency']].iloc[:10]
Out[12]:
entry_pl symbol entry_shares entry_price exit_price Efficiency
entry_time
2023-04-27 10:09:20.512 118.1800 ALGN 38 310.5600 313.67 3.1100
2023-04-27 10:09:20.512 118.1800 ALGN 38 310.5600 313.67 3.1100
2023-02-02 10:14:41.552 104.3800 ALGN 34 347.9300 351.00 3.0700
2023-02-03 09:54:44.510 100.6400 ALGN 34 346.7600 349.72 2.9600
2023-03-07 10:18:21.404 99.0500 ALGN 35 336.2800 339.11 2.8300
2023-02-02 10:03:34.699 98.0000 ALGN 35 342.2000 345.00 2.8000
2023-02-02 10:03:34.699 98.0000 ALGN 35 342.2000 345.00 2.8000
2023-02-02 10:03:34.699 98.0000 ALGN 35 342.2000 345.00 2.8000
2023-02-02 10:03:34.699 98.0000 ALGN 35 342.2000 345.00 2.8000
2023-03-16 10:46:46.264 101.3156 ALGN 38 315.0038 317.67 2.6662

Bottom Efficient Trades

In [13]:
odr.sort_values(by='Efficiency',ascending=True)[['entry_pl','symbol','entry_shares','entry_price','exit_price','Efficiency']].iloc[:10]
Out[13]:
entry_pl symbol entry_shares entry_price exit_price Efficiency
entry_time
2023-02-14 10:30:51.131 -150.84 ALGN 36 328.28 324.09 -4.19
2023-02-14 10:30:51.131 -150.84 ALGN 36 328.28 324.09 -4.19
2023-02-01 14:35:30.006 -3.67 SPY -1 403.32 406.99 -3.67
2023-02-01 14:36:00.006 -3.27 SPY -1 403.72 406.99 -3.27
2023-04-28 10:50:00.006 -118.40 ALGN 37 322.03 318.83 -3.20
2023-02-08 10:21:09.364 -154.23 ADSK 53 224.87 221.96 -2.91
2023-02-08 10:21:09.364 -154.23 ADSK 53 224.87 221.96 -2.91
2023-04-12 10:29:20.006 -100.10 ALGN 35 340.41 337.55 -2.86
2023-02-08 10:21:55.128 -146.81 ADSK 53 224.73 221.96 -2.77
2023-04-12 10:42:10.006 -96.60 ALGN 35 337.55 334.79 -2.76

Winner Loser Summary

In [14]:
summaryWinLoseDate(odr).fillna(0).style.bar(subset='Total',color='#d65f5f')
Out[14]:
Total Winners Losers
Win entry_shares entry_pl AvgPNL Win entry_pl entry_shares AvgPNL Win entry_pl entry_shares AvgPNL
2023-02-01 4122 691443 4796.74 1.16 2436 29275.3 529023 12.02 1686 -24478.6 162420 -14.52
2023-02-02 3232 602519 3058.56 0.95 1659 23532.2 313379 14.18 1573 -20473.7 289140 -13.02
2023-02-03 3913 822199 3543.32 0.91 2052 28039.3 520342 13.66 1861 -24496 301857 -13.16
2023-02-06 4011 733942 1722.19 0.43 2162 21456.3 469161 9.92 1849 -19734.1 264781 -10.67
2023-02-07 2851 530364 3725.76 1.31 1657 20420.3 348819 12.32 1194 -16694.6 181545 -13.98
2023-02-08 570 134912 -2006.61 -3.52 257 4929.48 43828 19.18 313 -6936.09 91084 -22.16
2023-02-09 4385 849978 7387.8 1.68 2218 30618.6 465502 13.8 2167 -23230.8 384476 -10.72
2023-02-10 3569 765265 2775.67 0.78 1987 20224.7 475084 10.18 1582 -17449 290181 -11.03
2023-02-13 3045 513157 5652.32 1.86 1774 16538.5 464923 9.32 1271 -10886.1 48234 -8.57
2023-02-14 3656 757632 5297.19 1.45 1897 31393.5 452433 16.55 1759 -26096.3 305199 -14.84
2023-02-15 1543 163144 -347.26 -0.23 801 9509.79 173737 11.87 742 -9857.05 -10593 -13.28
2023-02-16 3241 644217 5252.62 1.62 1909 21377.6 498318 11.2 1332 -16125 145899 -12.11
2023-02-17 3196 491079 5845.32 1.83 1834 20684.5 319326 11.28 1362 -14839.2 171753 -10.9
2023-02-21 3540 718028 2709.75 0.77 1989 19379.4 512584 9.74 1551 -16669.6 205444 -10.75
2023-02-22 3723 779740 7034.17 1.89 2073 25513.7 528012 12.31 1650 -18479.5 251728 -11.2
2023-02-23 3272 744989 7449.31 2.28 1857 22067 513221 11.88 1415 -14617.7 231768 -10.33
2023-02-24 3831 794931 5972.02 1.56 2202 26093.9 563255 11.85 1629 -20121.9 231676 -12.35
2023-02-27 3797 813818 6081.35 1.6 2064 21812.5 533172 10.57 1733 -15731.1 280646 -9.08
2023-02-28 3224 715074 2446.33 0.76 1666 17109 414898 10.27 1558 -14662.7 300176 -9.41
2023-03-01 3876 875298 5202.95 1.34 2065 22243.4 491880 10.77 1811 -17040.5 383418 -9.41
2023-03-02 3159 753137 1112.32 0.35 1590 16610.2 412531 10.45 1569 -15497.9 340606 -9.88
2023-03-03 3068 642016 5157.68 1.68 1724 17318.7 478403 10.05 1344 -12161 163613 -9.05
2023-03-06 3861 859089 4721.91 1.22 1987 19932.8 480124 10.03 1874 -15210.8 378965 -8.12
2023-03-07 3788 906523 8821.14 2.33 2140 27319.4 609784 12.77 1648 -18498.2 296739 -11.22
2023-03-08 3716 676180 7045.36 1.9 2084 23700.5 429430 11.37 1632 -16655.1 246750 -10.21
2023-03-09 3931 1.13498e+06 8227.94 2.09 1979 27726.8 555247 14.01 1952 -19498.8 579730 -9.99
2023-03-10 3597 661676 4578.41 1.27 1805 30744.1 347160 17.03 1792 -26165.7 314516 -14.6
2023-03-13 134 29385 -2720.67 -20.3 46 999.17 24408 21.72 88 -3719.84 4977 -42.27
2023-03-14 4339 840326 4766.05 1.1 2254 33220.5 473285 14.74 2085 -28454.5 367041 -13.65
2023-03-15 906 215407 -1155.29 -1.28 503 6774.56 104913 13.47 403 -7929.86 110494 -19.68
2023-03-16 3172 731413 1855.1 0.58 1782 20134.5 494333 11.3 1390 -18279.4 237080 -13.15
2023-03-17 3025 611611 230.85 0.08 1454 20006.5 225726 13.76 1571 -19775.7 385885 -12.59
2023-03-20 3352 715486 2254.22 0.67 1760 17062.7 468352 9.69 1592 -14808.4 247134 -9.3
2023-03-21 3820 1.07996e+06 6521.36 1.71 2162 24482.2 797923 11.32 1658 -17960.9 282042 -10.83
2023-03-22 2921 630287 -99.57 -0.03 1433 13655.6 358069 9.53 1488 -13755.2 272218 -9.24
2023-03-23 2559 673881 -124.94 -0.05 1208 14976.9 275139 12.4 1351 -15101.9 398742 -11.18
2023-03-24 3128 714619 4558.72 1.46 1670 19873.1 449991 11.9 1458 -15314.4 264628 -10.5
2023-03-27 3513 706197 3199.71 0.91 1828 19625.8 399544 10.74 1685 -16426 306653 -9.75
2023-03-28 3517 697713 5406.83 1.54 1906 19665.9 430443 10.32 1611 -14259.1 267270 -8.85
2023-03-29 3277 778804 3040.67 0.93 1775 17263.9 501054 9.73 1502 -14223.2 277750 -9.47
2023-03-30 3785 840878 2911.4 0.77 2053 17533.4 577761 8.54 1732 -14622 263117 -8.44
2023-03-31 3733 871061 5875.72 1.57 1963 19807.3 555298 10.09 1770 -13931.5 315763 -7.87
2023-04-03 3247 709862 45.65 0.01 1613 16104.6 426031 9.98 1634 -16058.9 283831 -9.83
2023-04-04 310 118799 -977.78 -3.15 113 3335.33 -3558 29.52 197 -4313.11 122357 -21.89
2023-04-05 3698 850234 4347.13 1.18 1935 21609.3 510136 11.17 1763 -17262.2 340098 -9.79
2023-04-06 2797 516716 5801.86 2.07 1569 15022.8 362317 9.57 1228 -9220.96 154399 -7.51
2023-04-10 3125 632195 8213.75 2.63 1881 18098.3 475487 9.62 1244 -9884.54 156708 -7.95
2023-04-11 3271 619763 3762.79 1.15 1588 18284.7 342552 11.51 1683 -14521.9 277211 -8.63
2023-04-12 3567 716024 6966.23 1.95 1939 24738.2 439912 12.76 1628 -17771.9 276112 -10.92
2023-04-13 3116 667965 5735.9 1.84 1815 16941 548582 9.33 1301 -11205.1 119383 -8.61
2023-04-14 3945 922981 9630.28 2.44 2270 26720.4 642841 11.77 1675 -17090.1 280140 -10.2
2023-04-17 3312 678237 2510.51 0.76 1625 16205 396000 9.97 1687 -13694.5 282237 -8.12
2023-04-18 3955 794711 6730.66 1.7 2131 21497.6 558385 10.09 1824 -14767 236326 -8.1
2023-04-19 986 227595 -618.35 -0.63 485 3850.37 89111 7.94 501 -4468.73 138484 -8.92
2023-04-20 3502 788041 2615.27 0.75 1720 17140 434829 9.97 1782 -14524.8 353212 -8.15
2023-04-21 3583 792013 7921.12 2.21 1946 22565.2 511404 11.6 1637 -14644.1 280609 -8.95
2023-04-24 3451 665967 2537.8 0.74 1887 15670.5 499911 8.3 1564 -13132.7 166056 -8.4
2023-04-25 3932 757022 6215.21 1.58 1998 24746.8 398226 12.39 1934 -18531.5 358796 -9.58
2023-04-26 3365 764125 5355.98 1.59 1769 18552.3 428631 10.49 1596 -13196.4 335494 -8.27
2023-04-27 2775 518913 4166.63 1.5 1580 15366.8 401102 9.73 1195 -11200.1 117811 -9.37
2023-04-28 3712 846837 2901.58 0.78 1878 21154.8 511608 11.26 1834 -18253.3 335229 -9.95
2023-05-01 3332 788311 1667.09 0.5 1743 17867.4 392577 10.25 1589 -16200.3 395734 -10.2
2023-05-02 3203 649452 2264.06 0.71 1686 20841.1 367371 12.36 1517 -18577.1 282081 -12.25
2023-05-03 4403 1.14845e+06 9207.85 2.09 2542 38502.9 801161 15.15 1861 -29295 347291 -15.74
2023-05-04 3524 911526 6459.72 1.83 1855 24193.5 482383 13.04 1669 -17733.8 429143 -10.63
In [15]:
# Report View
def report_view():
    '''Returns an IPython.display.HTML object that hides input cells, output prompts, and the
    Bokeh banner to make a notebook look like a report.

    To use this function, just call report_view() in a cell all by itself in your notebook.
    '''

    return HTML('''<script>
    code_show=true; 
    function code_toggle() {
     if (code_show){
     $('div.input').hide();
     $('div.bk-banner').hide(); 
     $('div.output_prompt').css({"visibility":"hidden"});
     } else {
     $('div.input').show();
     $('div.bk-banner').show(); 
     $('div.output_prompt').css({"visibility":"visible"});
     }
     code_show = !code_show
    } 
    $( document ).ready(code_toggle);
    </script>
    <form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
report_view()
Out[15]: